package com.zyk.leetcode;

/**
 * @author zhangsan
 * @date 2021/4/18 13:03
 */
public class C111 {

    public int minDepth(TreeNode root) {
        if(root == null) return 0;
        return process(root);
    }

    public int process(TreeNode root) {
        if(root == null) return Integer.MAX_VALUE;
        if(root.left == null && root.right == null) return 1;
        return Math.min(process(root.left), process(root.right)) + 1;
    }

}
